#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<math.h>

int is_narcissistic_number(int n)
{
	int count = 0;
	int x = n;
	int sum = 0;
	while (x != 0)
	{
		x /= 10;
		count++;
	}
	x = n;
	while (n != 0)
	{
		sum += (int)pow(n % 10, count);
		n /= 10;
	}
	if (sum == x)
		return 1;
	else
		return 0;
}

int main()
{
	int i = 0;
	for (i = 0; i < 100000; i++)
		if (is_narcissistic_number(i))
			printf("%d ", i);
	return 0;
}